//
//  Small_StandbyLeft_01.swift
//  TimMusic
//
//  Created by nkl on 2024/10/25.
//

import Foundation
import SwiftUI

struct Small_StandbyLeft_01: View {
    var model: ControlMusicModel

    var body: some View {
        ZStack {
            Color.black.ignoresSafeArea()
            VStack(alignment: .center) {
                ColorsTimerView()
                Spacer()
                    .frame(height: 2)

                Text(DateFormatter().simpleMonthAndDay())
                    .font(.system(size: 10))
                    .foregroundColor(.white)
                    .opacity(0.7)
                Spacer()
                    .frame(height: 6)
                VStack(spacing: 5) {
                    Text(model.title)
                        .font(.system(size: 14))
                        .lineLimit(1)
                        .foregroundColor(Color(hex: "#C74B2A"))
                    Text(model.auth)
                        .font(.system(size: 12))
                        .opacity(0.7)
                        .lineLimit(1)
                        .foregroundColor(Color(hex: "#C74B2A").opacity(0.6))
                    HStack(spacing: 24) {
                        Image("ic_standby_last").resizable().frame(width: 24, height: 24)
                            .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.playlast.rawValue)", isStatic: model.isStatic))
                        if model.isPlay {
                            Image("ic_standby_pause").resizable().frame(width: 24, height: 24)
                                .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.pause.rawValue)", isStatic: model.isStatic))
                        } else {
                            Image("ic_standby_play").resizable().frame(width: 24, height: 24)
                                .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.play.rawValue)", isStatic: model.isStatic))
                        }
                        Image("ic_standby_next").resizable().frame(width: 24, height: 24)
                            .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.playnext.rawValue)", isStatic: model.isStatic))
                    }
                }
                .frame(width: 152, height: 82)
                .background(Color.white.opacity(0.1))
                .cornerRadius(22)
            }
        }
    }

    struct ColorsTimerView: View {
        var body: some View {
            HStack(spacing: 0) {
                TimeTextLabel(style: .hourTen, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#FF5C4A".toColor())

                TimeTextLabel(style: .hourSingle, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#FDDA4E".toColor())

                Text(":").font(Font(UIFont.HarmonyOSSansSCBold(size: 30)))
                    .foregroundColor(Color.white)
                    .opacity(0.6)

                TimeTextLabel(style: .minuteTen, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#FF857D".toColor())

                TimeTextLabel(style: .minuteSingle, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#B3992B".toColor())

                Text(":")
                    .font(Font(UIFont.HarmonyOSSansSCBold(size: 30)))
                    .foregroundColor(Color.white)
                    .opacity(0.6)

                TimeTextLabel(style: .secondTen, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#FF5C4A".toColor())

                TimeTextLabel(style: .secondSingle, date: Date(), font: .HarmonyOSSansSCBold(size: 30), color: "#FDDA4E".toColor())
            }
        }
    }
}
